home *** CD-ROM | disk | FTP | other *** search
- unit JimShape;
-
- {$B-}
-
- interface
-
- uses
- Windows, Controls, Classes;
-
- type
- TjimCustomShape = class(TGraphicControl)
- // All controls descend from this, to help with streaming and unique naming
- private
- protected
- public
- constructor Create(AOwner : TComponent); override;
-
- procedure SetBounds(ALeft,ATop,AWidth,AHeight : Integer); override;
- published
- // Make these properties available, so we can respond to mouse clicks
- property OnClick;
- property OnDblClick;
- end;
-
-
- TjimTextShape = class(TjimCustomShape)
- private
- FText : string;
- FAutosize : Boolean;
-
- procedure SetText(Value : string);
- procedure SetAutosize(Value : Boolean);
- protected
- procedure Paint; override;
- public
- constructor Create(AOwner : TComponent); override;
-
- procedure SetBounds(ALeft,ATop,AWidth,AHeight : Integer); override;
- published
- property Text : string read FText write SetText;
- property Autosize : Boolean read FAutosize write SetAutosize;
- end;
-
-
- TjimBitmapShape = class(TjimCustomShape)
- private
- FImages : TImageList;
- FImageIndex : Integer;
- FCaption : TjimTextShape;
-
- procedure SetImages(Value : TImageList);
- procedure SetImageIndex(Value : Integer);
- procedure SetCaption(Value : TjimTextShape);
- protected
- procedure Paint; override;
- procedure Notification(AComponent : TComponent;Operation : TOperation); override;
- public
- constructor Create(AOwner : TComponent); override;
-
- procedure SetBounds(ALeft,ATop,AWidth,AHeight : Integer); override;
- published
- property Images : TImageList read FImages write SetImages;
- property ImageIndex : Integer read FImageIndex write SetImageIndex;
- property Caption : TjimTextShape read FCaption write SetCaption;
- end;
-
-
- TjimConnectionSide = (csLeft,csRight,csTop,csBottom);
-
-
- TjimConnection = class(TPersistent)
- private
- FShape : TjimCustomShape;
- FSide : TjimConnectionSide; // Side to connect to
- FOffset : Integer; // Distance from top or left of side
- public
- constructor Create;
-
- procedure Assign(Source : TPersistent); override;
- // Gets connection point in parent's coordinates
- function ConnPoint(TerminatorRect : TRect): TPoint;
- // Gets terminator connection point in parent's coordinates
- function TermPoint(TerminatorRect : TRect): TPoint;
- // Functions to get boundaries of the terminators
- function LeftMost(TerminatorRect : TRect): TPoint;
- function RightMost(TerminatorRect : TRect): TPoint;
- function TopMost(TerminatorRect : TRect): TPoint;
- function BottomMost(TerminatorRect : TRect): TPoint;
- published
- property Shape : TjimCustomShape read FShape write FShape;
- property Side : TjimConnectionSide read FSide write FSide;
- property Offset : Integer read FOffset write FOffset;
- end;
-
-
- TjimConnector = class(TjimCustomShape)
- private
- FLineWidth : Integer;
- // The shapes connected by this control
- FStartConn : TjimConnection;
- FEndConn : TjimConnection;
- // Area of the terminator symbol to be drawn (in horizontal position)
- FStartTermRect : TRect;
- FEndTermRect : TRect;
-
- procedure SetLineWidth(Value : Integer);
- function GetConn(Index : Integer) : TjimConnection;
- procedure SetConn(Index : Integer;Value : TjimConnection);
- function GetTermRect(Index : Integer) : TRect;
- procedure SetTermRect(Index : Integer;Value : TRect);
- protected
- procedure Paint; override;
- procedure Notification(AComponent : TComponent;Operation : TOperation); override;
- // For drawing arrows etc. Called from Paint.
- procedure DrawStartTerminator; virtual;
- procedure DrawEndTerminator; virtual;
- // Converts point from parent's coordinates to own coordinates
- function Convert(APoint : TPoint) : TPoint;
- function IsConnected(ConnectedShape : TjimCustomShape) : Boolean;
- public
- constructor Create(AOwner : TComponent); override;
- destructor Destroy; override;
-
- // Restrict the minimum size
- procedure SetBounds(ALeft,ATop,AWidth,AHeight : Integer); override;
- // Called when moving one of the connected shapes
- procedure SetBoundingRect;
- procedure SetConnections(TheStartConn,TheEndConn : TjimConnection);
-
- property StartTermRect : TRect index 1 read GetTermRect write SetTermRect;
- property EndTermRect : TRect index 2 read GetTermRect write SetTermRect;
- published
- // Publish these properties so that component streaming can be used to
- // store them in a file
- property LineWidth : Integer read FLineWidth write SetLineWidth default 1;
- property StartConn : TjimConnection index 1 read GetConn write SetConn;
- property EndConn : TjimConnection index 2 read GetConn write SetConn;
- end;
-
-
- TjimSingleHeadArrow = class(TjimConnector)
- protected
- procedure DrawArrowHead(ConnPt,TermPt : TPoint);
- procedure DrawEndTerminator; override;
- public
- constructor Create(AOwner : TComponent); override;
- end;
-
-
- implementation
-
- uses
- SysUtils, Graphics, ImgList;
-
-
- var
- FShapeCount : Integer;
- // Used in unique naming scheme. It is global in this unit to enable a
- // 'memory' of the component names used during the lifetime of this unit.
-
-
- procedure NoLessThan(var Value : Integer;Limit : Integer);
- begin {NoLessThan}
- if Value < Limit then begin
- Value := Limit;
- end;
- end; {NoLessThan}
-
-
- function RectHeight(ARect : TRect) : Integer;
- begin {RectHeight}
- Result := ARect.Bottom - ARect.Top;
- end; {RectHeight}
-
-
- function RectWidth(ARect : TRect) : Integer;
- begin {RectWidth}
- Result := ARect.Right - ARect.Left;
- end; {RectWidth}
-
-
- function Min(A : array of Integer) : Integer;
- var
- i : Integer;
- begin {Min}
- Result := 0; // Purely to stop compiler warnings
-
- for i := Low(A) to High(A) do begin
- if i = Low(A) then begin
- Result := A[i]
- end else if A[i] < Result then begin
- Result := A[i];
- end;
- end;
- end; {Min}
-
-
- function Max(A : array of Integer) : Integer;
- var
- i : Integer;
- begin {Max}
- Result := 0; // Purely to stop compiler warnings
-
- for i := Low(A) to High(A) do begin
- if i = Low(A) then begin
- Result := A[i]
- end else if A[i] > Result then begin
- Result := A[i];
- end;
- end;
- end; {Max}
-
-
- // ---------------------------- TjimCustomShape ------------------------------
-
- constructor TjimCustomShape.Create(AOwner : TComponent);
- var
- AlreadyUsed : Boolean;
- i : Integer;
- TempName : string;
- begin {Create}
- inherited Create(AOwner);
-
- // Give the component a name and ensure that it is unique
- repeat
- // Use a local variable to hold the name, so that don't get exceptions
- // raised on duplicate names
- TempName := 'Shape' + IntToStr(FShapeCount);
- Inc(FShapeCount);
- AlreadyUsed := False;
-
- // Loop through all the components on the form to ensure that this name
- // is not already in use
- for i := 0 to Owner.ComponentCount - 1 do begin
- if Owner.Components[i].Name = TempName then begin
- // Try the next component name as this one is used already
- AlreadyUsed := True;
- Break;
- end;
- end;
- until not AlreadyUsed;
-
- Name := TempName;
- end; {Create}
-
-
- procedure TjimCustomShape.SetBounds(ALeft,ATop,AWidth,AHeight : Integer);
- var
- i : Integer;
- begin {SetBounds}
- inherited SetBounds(ALeft,ATop,AWidth,AHeight);
-
- // Search for any connectors between this and any other control
- // First check that this control has been placed on a form
- if not Assigned(Parent) then begin
- Exit;
- end;
-
- // Search parent control for TjimConnector components
- for i := 0 to Parent.ControlCount - 1 do begin
- if Parent.Controls[i] is TjimConnector then begin
- with TjimConnector(Parent.Controls[i]) do begin
- // Check if this component is at either end of the connector
- if IsConnected(Self) then begin
- // Resize the connector
- TjimConnector(Parent.Controls[i]).SetBoundingRect;
- end;
- end;
- end;
- end;
- end; {SetBounds}
-
-
- // ----------------------------- TjimTextShape ------------------------------
-
- constructor TjimTextShape.Create(AOwner : TComponent);
- begin {Create}
- inherited Create(AOwner);
- FAutosize := True;
- FText := '';
- end; {Create}
-
-
- procedure TjimTextShape.SetText(Value : string);
- begin {SetText}
- if FText <> Value then begin
- FText := Value;
- SetBounds(Left,Top,Width,Height);
- end;
- end; {SetText}
-
-
- procedure TjimTextShape.SetAutosize(Value : Boolean);
- begin {SetText}
- if FAutosize <> Value then begin
- FAutosize := Value;
- SetBounds(Left,Top,Width,Height);
- end;
- end; {SetText}
-
-
- procedure TjimTextShape.Paint;
- var
- TempRect : TRect;
- begin {Paint}
- inherited Paint;
-
- if not Assigned(Parent) then begin
- Exit;
- end;
-
- TempRect := ClientRect; // So can pass as a var parameter
- DrawText(Canvas.Handle,PChar(FText),Length(FText),TempRect,
- DT_CENTER or DT_NOPREFIX or DT_WORDBREAK);
- end; {Paint}
-
-
- procedure TjimTextShape.SetBounds(ALeft,ATop,AWidth,AHeight : Integer);
- begin {SetBounds}
- // Check that the control bounds are sensible. Note that this also works
- // if try to set Left, Top etc properties, as their access methods call
- // SetBounds().
- if FAutosize and Assigned(Parent) then begin
- NoLessThan(AWidth,Canvas.TextWidth(FText));
- NoLessThan(AHeight,Canvas.TextHeight(FText));
- end;
-
- inherited SetBounds(ALeft,ATop,AWidth,AHeight);
- end; {SetBounds}
-
-
- // ---------------------------- TjimBitmapShape ------------------------------
-
- constructor TjimBitmapShape.Create(AOwner : TComponent);
- begin {Create}
- inherited Create(AOwner);
- FImages := nil;
- FImageIndex := 0;
- FCaption := nil;
- end; {Create}
-
-
- procedure TjimBitmapShape.SetImages(Value : TImageList);
- begin {SetImages}
- if Value <> FImages then begin
- FImages := Value;
-
- if FImages <> nil then begin
- // Set the size of the component to the image size
- SetBounds(Left,Top,FImages.Width,FImages.Height);
- end;
- end;
- end; {SetImages}
-
-
- procedure TjimBitmapShape.SetImageIndex(Value : Integer);
- begin {SetImageIndex}
- if Value <> FImageIndex then begin
- FImageIndex := Value;
- Invalidate;
- end;
- end; {SetImageIndex}
-
-
- procedure TjimBitmapShape.SetCaption(Value : TjimTextShape);
- begin {SetCaption}
- if (Value = nil) and Assigned(FCaption) then begin
- FCaption.Free;
- end else if (Value <> FCaption) then begin
- FCaption := Value;
- // Ensure the caption get aligned correctly
- SetBounds(Left,Top,Width,Height);
- end;
- end; {SetCaption}
-
-
- procedure TjimBitmapShape.SetBounds(ALeft,ATop,AWidth,AHeight : Integer);
- begin {SetBounds}
- inherited SetBounds(ALeft,ATop,AWidth,AHeight);
-
- // Set the position of the associated TjimTextShape control
- if Assigned(FCaption) then begin
- FCaption.SetBounds(ALeft,ATop + AHeight + 5,FCaption.Width,FCaption.Height);
- end;
- end; {SetBounds}
-
-
- procedure TjimBitmapShape.Paint;
- begin {Paint}
- inherited Paint;
-
- if (not Assigned(Parent)) or
- (not Assigned(FImages)) or
- (FImageIndex < 0) or
- (FImageIndex >= FImages.Count) then begin
- // The component has not been placed on a form yet, or does not have an
- // associated image
- Exit;
- end;
-
- FImages.DrawingStyle := dsTransparent;
- FImages.Draw(Canvas,0,0,FImageIndex);
- end; {Paint}
-
-
- procedure TjimBitmapShape.Notification(AComponent : TComponent;Operation : TOperation);
- begin {Notification}
- inherited Notification(AComponent,Operation);
-
- if Operation = opRemove then begin
- if AComponent = FImages then begin
- FImages := nil;
- end else if AComponent = FCaption then begin
- FCaption := nil;
- end;
- end;
- end; {Notification}
-
-
- // ----------------------------- TjimConnection ------------------------------
-
- constructor TjimConnection.Create;
- begin {Create}
- inherited Create;
- FShape := nil;
- FSide := csRight;
- FOffset := 0;
- end; {Create}
-
-
- procedure TjimConnection.Assign(Source : TPersistent);
- begin {Assign}
- if Source is TjimConnection then begin
- FShape := TjimConnection(Source).FShape;
- FSide := TjimConnection(Source).FSide;
- FOffset := TjimConnection(Source).FOffset;
- end else begin
- inherited Assign(Source);
- end;
- end; {Assign}
-
-
- function TjimConnection.ConnPoint(TerminatorRect : TRect): TPoint;
- var
- X,Y,W : Integer;
- begin {ConnPoint}
- Result := Point(0,0);
- X := 0;
- Y := 0;
- W := TerminatorRect.Right - TerminatorRect.Left;
-
- if FShape = nil then begin
- Exit;
- end;
-
- case FSide of
- csLeft : begin
- X := FShape.Left - W;
- Y := FShape.Top + FOffset;
- end;
-
- csRight : begin
- X := FShape.Left + FShape.Width - 1 + W;
- Y := FShape.Top + FOffset;
- end;
-
- csTop : begin
- X := FShape.Left + FOffset;
- Y := FShape.Top - W;
- end;
-
- csBottom : begin
- X := FShape.Left + FOffset;
- Y := FShape.Top + FShape.Height - 1 + W;
- end;
- end;
-
- Result := Point(X,Y);
- end; {ConnPoint}
-
-
- function TjimConnection.TermPoint(TerminatorRect : TRect): TPoint;
- var
- X,Y : Integer;
- begin {TermPoint}
- Result := Point(0,0);
- X := 0;
- Y := 0;
-
- if FShape = nil then begin
- Exit;
- end;
-
- case FSide of
- csLeft : begin
- X := FShape.Left;
- Y := FShape.Top + FOffset;
- end;
-
- csRight : begin
- X := FShape.Left + FShape.Width - 1;
- Y := FShape.Top + FOffset;
- end;
-
- csTop : begin
- X := FShape.Left + FOffset;
- Y := FShape.Top;
- end;
-
- csBottom : begin
- X := FShape.Left + FOffset;
- Y := FShape.Top + FShape.Height - 1;
- end;
- end;
-
- Result := Point(X,Y);
- end; {TermPoint}
-
-
- function TjimConnection.LeftMost(TerminatorRect : TRect): TPoint;
- begin {LeftMost}
- Result := TermPoint(TerminatorRect);
-
- if FShape = nil then begin
- Exit;
- end;
-
- case FSide of
- csLeft : Result.X := FShape.Left - RectWidth(TerminatorRect);
- csRight : Result.X := FShape.Left + FShape.Width;
- csTop,
- csBottom : Result.X := FShape.Left + FOffset - (RectWidth(TerminatorRect) div 2);
- end;
- end; {LeftMost}
-
-
- function TjimConnection.RightMost(TerminatorRect : TRect): TPoint;
- begin {RightMost}
- Result := TermPoint(TerminatorRect);
-
- if FShape = nil then begin
- Exit;
- end;
-
- case FSide of
- csLeft : Result.X := FShape.Left - 1;
- csRight : Result.X := FShape.Left + FShape.Width - 1 + RectWidth(TerminatorRect);
- csTop,
- csBottom : Result.X := FShape.Left + FOffset + (RectWidth(TerminatorRect) div 2);
- end;
- end; {RightMost}
-
-
- function TjimConnection.TopMost(TerminatorRect : TRect): TPoint;
- begin {TopMost}
- Result := TermPoint(TerminatorRect);
-
- if FShape = nil then begin
- Exit;
- end;
-
- case FSide of
- csLeft,
- csRight : Result.Y := FShape.Top + FOffset - (RectHeight(TerminatorRect) div 2);
- csTop : Result.Y := FShape.Top - RectHeight(TerminatorRect);
- csBottom : Result.Y := FShape.Top + FShape.Height;
- end;
- end; {TopMost}
-
-
- function TjimConnection.BottomMost(TerminatorRect : TRect): TPoint;
- begin {BottomMost}
- Result := TermPoint(TerminatorRect);
-
- if FShape = nil then begin
- Exit;
- end;
-
- case FSide of
- csLeft,
- csRight : Result.Y := FShape.Top + FOffset + (RectHeight(TerminatorRect) div 2);
- csTop : Result.Y := FShape.Top - 1;
- csBottom : Result.Y := FShape.Top + FShape.Height - 1 + RectHeight(TerminatorRect);
- end;
- end; {BottomMost}
-
-
- // ----------------------------- TjimConnector -------------------------------
-
- constructor TjimConnector.Create(AOwner : TComponent);
- begin {Create}
- inherited Create(AOwner);
- FLineWidth := 1;
- FStartTermRect := Rect(0,0,0,0);
- FEndTermRect := Rect(0,0,0,0);
- FStartConn := TjimConnection.Create;
- FEndConn := TjimConnection.Create;
- end; {Create}
-
-
- destructor TjimConnector.Destroy;
- begin {Destroy}
- FStartConn.Free;
- FEndConn.Free;
- inherited Destroy;
- end; {Destroy}
-
-
- procedure TjimConnector.Paint;
- var
- EndPt : TPoint;
- begin {Paint}
- inherited Paint;
-
- if not Assigned(Parent) then begin
- Exit;
- end;
-
- if Assigned(FStartConn.Shape) and Assigned(FEndConn.Shape) then begin
- // Draw the terminators (arrows etc)
- DrawStartTerminator;
- DrawEndTerminator;
-
- with Canvas do begin
- // Draw the connecting line
- Brush.Style := bsClear;
- Pen.Width := FLineWidth;
- Pen.Color := clBlack;
- // Convert from Parent coordinates to control coordinates
- PenPos := Convert(FStartConn.ConnPoint(FStartTermRect));
- EndPt := Convert(FEndConn.ConnPoint(FEndTermRect));
- LineTo(EndPt.X,EndPt.Y);
- end;
- end;
- end; {Paint}
-
-
- procedure TjimConnector.Notification(AComponent : TComponent;Operation : TOperation);
- begin {Notification}
- inherited Notification(AComponent,Operation);
-
- if Operation = opRemove then begin
- if AComponent = FStartConn.FShape then begin
- FStartConn.FShape := nil;
- end;
-
- if AComponent = FEndConn.FShape then begin
- FEndConn.FShape := nil;
- end;
- end;
- end; {Notification}
-
-
- procedure TjimConnector.DrawStartTerminator;
- begin {DrawStartTerminator}
- end; {DrawStartTerminator}
-
-
- procedure TjimConnector.DrawEndTerminator;
- begin {DrawEndTerminator}
- end; {DrawEndTerminator}
-
-
- procedure TjimConnector.SetBounds(ALeft,ATop,AWidth,AHeight : Integer);
- begin {SetBounds}
- // Ensure the control is at least as big as the line width
- NoLessThan(AHeight,FLineWidth);
- NoLessThan(AWidth,FLineWidth);
- // Ensure the control is at least as big as the start terminator rectangle
- NoLessThan(AHeight,RectHeight(FStartTermRect));
- NoLessThan(AWidth,RectWidth(FStartTermRect));
- // Ensure the control is at least as big as the end terminator rectangle
- NoLessThan(AHeight,RectHeight(FEndTermRect));
- NoLessThan(AWidth,RectWidth(FEndTermRect));
-
- inherited SetBounds(ALeft,ATop,AWidth,AHeight);
- end; {SetBounds}
-
-
- procedure TjimConnector.SetLineWidth(Value : Integer);
- begin {SetLineWidth}
- // Ensure that can always see the line!
- if Value >= 1 then begin
- FLineWidth := Value;
- end;
- end; {SetLineWidth}
-
-
- function TjimConnector.GetConn(Index : Integer) : TjimConnection;
- begin {GetConn}
- Result := nil;
-
- case Index of
- 1 : Result := FStartConn;
- 2 : Result := FEndConn;
- end;
- end; {GetConn}
-
-
- procedure TjimConnector.SetConn(Index : Integer;Value : TjimConnection);
- begin {SetConn}
- case Index of
- 1 : FStartConn.Assign(Value);
- 2 : FEndConn.Assign(Value);
- end;
-
- SetBoundingRect;
- end; {SetConn}
-
-
- procedure TjimConnector.SetBoundingRect;
- var
- L,T,W,H : Integer;
- begin {SetBoundingRect}
- if (FStartConn.Shape = nil) or (FEndConn.Shape = nil) then begin
- Exit;
- end;
-
- L := Min([FStartConn.LeftMost(FStartTermRect).X,
- FEndConn.LeftMost(FEndTermRect).X]);
- T := Min([FStartConn.TopMost(FStartTermRect).Y,
- FEndConn.TopMost(FEndTermRect).Y]);
- W := Max([FStartConn.RightMost(FStartTermRect).X,
- FEndConn.RightMost(FEndTermRect).X]) -
- Min([FStartConn.LeftMost(FStartTermRect).X,
- FEndConn.LeftMost(FEndTermRect).X]) + 1;
- H := Max([FStartConn.BottomMost(FStartTermRect).Y,
- FEndConn.BottomMost(FEndTermRect).Y]) -
- Min([FStartConn.TopMost(FStartTermRect).Y,
- FEndConn.TopMost(FEndTermRect).Y]) + 1;
- SetBounds(L,T,W,H);
- SetZOrder(False); // Move to bottom
- end; {SetBoundingRect}
-
-
- procedure TjimConnector.SetConnections(TheStartConn,TheEndConn : TjimConnection);
- begin {SetConnections}
- StartConn := TheStartConn;
- EndConn := TheEndConn;
- SetZOrder(False); // Move to bottom
- end; {SetConnections}
-
-
- function TjimConnector.GetTermRect(Index : Integer) : TRect;
- begin {GetTermRect}
- case Index of
- 1 : Result := FStartTermRect;
- 2 : Result := FEndTermRect;
- end;
- end; {GetTermRect}
-
-
- procedure TjimConnector.SetTermRect(Index : Integer;Value : TRect);
- begin {SetTermRect}
- if (Value.Right - Value.Left >= 0) and (Value.Bottom - Value.Top >= 0) then begin
- case Index of
- 1 : FStartTermRect := Value;
- 2 : FEndTermRect := Value;
- end;
- end;
- end; {SetTermRect}
-
-
- function TjimConnector.Convert(APoint : TPoint) : TPoint;
- begin {Convert}
- Result := ScreenToClient(Parent.ClientToScreen(APoint));
- end; {Convert}
-
-
- function TjimConnector.IsConnected(ConnectedShape : TjimCustomShape) : Boolean;
- begin {IsConnected}
- Result := (FStartConn.Shape = ConnectedShape) or
- (FEndConn.Shape = ConnectedShape);
- end; {IsConnected}
-
-
- // ------------------------- TjimSingleHeadArrow ---------------------------
-
- constructor TjimSingleHeadArrow.Create(AOwner : TComponent);
- begin {Create}
- inherited Create(AOwner);
- EndTermRect := Rect(0,0,25,10);
- end; {Create}
-
-
- procedure TjimSingleHeadArrow.DrawArrowHead(ConnPt,TermPt : TPoint);
- var
- PointPt,Corner1Pt,Corner2Pt : TPoint;
- begin {DrawArrowHead}
- with Canvas do begin
- Brush.Style := bsSolid;
- Brush.Color := clBlack;
-
- // Draw a line connecting the Conn and Term points
- PenPos := ConnPt;
- LineTo(TermPt.X,TermPt.Y);
- // Set the basic points (to be modified depending on arrow head direction
- PointPt := TermPt;
- Corner1Pt := ConnPt;
- Corner2Pt := ConnPt;
-
- if ConnPt.X < TermPt.X then begin
- // Draw a right pointing arrow head
- Inc(Corner1Pt.X,10);
- Inc(Corner2Pt.X,10);
- Dec(Corner1Pt.Y,RectHeight(EndTermRect) div 2);
- Inc(Corner2Pt.Y,RectHeight(EndTermRect) div 2);
- end else if ConnPt.X > TermPt.X then begin
- // Draw a left pointing arrow head
- Dec(Corner1Pt.X,10);
- Dec(Corner2Pt.X,10);
- Dec(Corner1Pt.Y,RectHeight(EndTermRect) div 2);
- Inc(Corner2Pt.Y,RectHeight(EndTermRect) div 2);
- end else if ConnPt.Y < TermPt.Y then begin
- // Draw a down pointing arrow head
- Inc(Corner1Pt.Y,10);
- Inc(Corner2Pt.Y,10);
- Dec(Corner1Pt.X,RectHeight(EndTermRect) div 2);
- Inc(Corner2Pt.X,RectHeight(EndTermRect) div 2);
- end else begin
- // Draw a up pointing arrow head
- Dec(Corner1Pt.Y,10);
- Dec(Corner2Pt.Y,10);
- Dec(Corner1Pt.X,RectHeight(EndTermRect) div 2);
- Inc(Corner2Pt.X,RectHeight(EndTermRect) div 2);
- end;
-
- Polygon([PointPt,Corner1Pt,Corner2Pt]);
- end;
- end; {DrawArrowHead}
-
-
- procedure TjimSingleHeadArrow.DrawEndTerminator;
- var
- ConnPt,TermPt : TPoint;
- begin {DrawEndTerminator}
- inherited DrawEndTerminator;
-
- if Assigned(FEndConn.Shape) then begin
- ConnPt := Convert(FEndConn.ConnPoint(EndTermRect));
- TermPt := Convert(FEndConn.TermPoint(EndTermRect));;
- DrawArrowHead(ConnPt,TermPt);
- end;
- end; {DrawEndTerminator}
-
-
- end.
-